execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import mpi4py" RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE err)

if ( NOT ${res} EQUAL 0 )
 set( Mpi4py_FOUND 0 )
else ( NOT ${res} EQUAL 0 )
 execute_process(COMMAND "@PYTHON_EXECUTABLE@" -c "import mpi4py;print mpi4py.__version__" RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE err)
 if ( ${out} VERSION_LESS ${MPI4PY_MAJOR_MIN}.${MPI4PY_MINOR_MIN} )
   message("You need mpi4py version ${MPI4PY_MAJOR_MIN}.${MPI4PY_MINOR_MIN} at minimum")
   set( Mpi4py_FOUND 0 )
 else ()
   set( Mpi4py_FOUND 1 )
 endif ()
endif ( NOT ${res} EQUAL 0 )
